namespace com::sun::star::ucb
{ class XContent; class XCommandEnvironment;
}
namespace com::sun::star::sdbc
{ class XResultSet;
}
namespace sd
{ /** Representation of a template or layout file.
*/ class TemplateEntry
{ public:
TemplateEntry(OUString sTitle, OUString sPath)
: msTitle(std::move(sTitle))
, msPath(std::move(sPath))
{
}
OUString msTitle;
OUString msPath;
};
/** This class scans the template folders for impress templates. There are twowaystousethisclass. 1.TheoldanddeprecatedwayistocallScan()toscanalltemplates andcollectthesupportedonesinatreestructure.Thisstructureis returnedbyGetFolderList(). 2.ThenewwayimplementstheAsynchronousTaskinterface.Call RunNextStep()aslongHasNextStep()returns<TRUE/>.Aftereverystep GetLastAddedEntry()returnsthetemplatethatwasscanned(andhasa supportedformat)last.Whenastepdoesnotaddanewtemplatethen thevalueofthepreviousstepisreturned.
*/ class TemplateScanner final : public ::sd::tools::AsynchronousTask
{ public: /** Create a new template scanner and prepare but do not execute the scanning.
*/
TemplateScanner();
/** The destructor deletes any remaining entries of the local list of templates.
*/
~TemplateScanner();
/** Implementation of the AsynchronousTask interface method.
*/ virtualvoid RunNextStep() override;
/** Implementation of the AsynchronousTask interface method.
*/ virtualbool HasNextStep() override;
/** Return the TemplateDir object that was last added to mpTemplateEntries. @return <nullptr/>isreturnedeitherbeforethetemplatescanningis startedorafterithasended.
*/ const TemplateEntry* GetLastAddedEntry() const
{ return mpTemplateEntries.empty() ? nullptr : mpTemplateEntries.back().get();
}
private: /** The current state determines which step will be executed next by RunNextStep().
*/ enum State
{
INITIALIZE_SCANNING,
INITIALIZE_FOLDER_SCANNING,
GATHER_FOLDER_LIST,
SCAN_FOLDER,
INITIALIZE_ENTRY_SCAN,
SCAN_ENTRY,
DONE,
ERROR
};
State meState;
/** The folders that are collected by GatherFolderList().
*/ class FolderDescriptorList;
std::unique_ptr<FolderDescriptorList> mpFolderDescriptors;
/** Set of state variables used by the methods InitializeFolderScanning(),GatherFolderList(),ScanFolder(), InitializeEntryScanning(),andScanEntry().
*/
css::uno::Reference<css::ucb::XContent> mxTemplateRoot;
css::uno::Reference<css::ucb::XCommandEnvironment> mxFolderEnvironment;
css::uno::Reference<css::ucb::XCommandEnvironment> mxEntryEnvironment;
css::uno::Reference<css::sdbc::XResultSet> mxFolderResultSet;
css::uno::Reference<css::sdbc::XResultSet> mxEntryResultSet;
/** Obtain the root folder of the template folder hierarchy. The result isstoredinmxTemplateRootforlateruse.
*/
State GetTemplateRoot();
/** Initialize the scanning of folders. This is called exactly once. @return ReturnsoneofthetwostatesERRORorGATHER_FOLDER_LIST.
*/
State InitializeFolderScanning();
/** Collect all available top-level folders in an ordered list which can thenbeprocessedbyScanFolder(). @return ReturnsoneofthetwostatesERRORorSCAN_FOLDER.
*/
State GatherFolderList();
/** From the list of top-level folders collected by GatherFolderList() theonewithhighestpriorityisprocessed. @return ReturnsoneofthestatesERROR,DONE,orINITIALIZE_ENTRY_SCAN.
*/
State ScanFolder();
/** Initialize the scanning of entries of a top-level folder. @return ReturnsoneofthestatesERRORorSCAN_ENTRY.
*/
State InitializeEntryScanning();
/** Scan one entry. When this entry matches the recognized template typesitisappendedtotheresultset. @return ReturnsoneofthestatesERROR,SCAN_ENTRY,orSCAN_FOLDER.
*/
State ScanEntry();
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.