code: public CmsObject getOfflineCmsObject(CmsObject cms) {
  
          CmsObject res = null;
          try {
              if (!cms.getRequestContext().getCurrentProject().isOnlineProject()) {
                  return OpenCms.initCmsObject(cms);
              }
              res = OpenCms.initCmsObject(cms);
              List<CmsProject> projects = OpenCms.getOrgUnitManager().getAllAccessibleProjects(res, "/", true);
              Iterator<CmsProject> projIterator = projects.iterator();
              boolean offFound = false;
              while (projIterator.hasNext() & !offFound) {
                  CmsProject offP = projIterator.next();
                  if (!offP.isOnlineProject()) {
                      res.getRequestContext().setCurrentProject(offP);
                      offFound = true;
                  }
              }
          } catch (CmsException e) {
              return cms;
          }
          return res;
      }
docs: Gets an offline version of the cms object.<p>
  
  @param cms initial CmsObject
  @return CmsObject adjusted to offline project (cloned)