/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
The basic new concept introduced is a <em>path</em>:<br/> A <em>path</em> is a sequence of states, which are to be executed in a linear order. Elements in the path can be skipped, depending on choices the user makes.
In the most simple wizards, you will have only one path consisting of <code>n</code> elements, which are to be visited successively.
In a slightly more complex wizard, you will have one linear path, were certain steps might be skipped due to user input. For instance, the user may decide to not specify certain aspects of the to-be-created object (e.g. by unchecking a check box), and the wizard then will simply disable the step which corresponds to this step.
In a yet more advanced wizards, you will have several paths of length <code>n1</code> and <code>n2</code>, which share at least the first <code>k</code> states (where <code>k</code> is at least 1), and an arbitrary number of other states.
*/ class RoadmapWizard final : public Dialog
{ private:
Idle maWizardLayoutIdle;
Size maPageSize;
ImplWizPageData* mpFirstPage;
ImplWizButtonData* mpFirstBtn;
VclPtr<TabPage> mpCurTabPage;
VclPtr<PushButton> mpPrevBtn;
VclPtr<PushButton> mpNextBtn;
VclPtr<ORoadmap> mpRoadmap;
std::map<VclPtr<vcl::Window>, short> maResponses;
sal_uInt16 mnCurLevel;
sal_Int16 mnLeftAlignCount; bool mbEmptyViewMargin;
// IMPORTANT: // traveling pages should not be done by calling these base class member, some mechanisms of this class // here (e.g. committing page data) depend on having full control over page traveling. // So use the travelXXX methods if you need to travel
tools::Long LogicalCoordinateToPixel(int iCoordinate) const; /**sets the number of buttons which should be left-aligned. Normally, buttons are right-aligned.
only to be used during construction, before any layouting happened
*/ void SetLeftAlignedButtonCount( sal_Int16 _nCount );
private:
std::unique_ptr<WizardMachineImplData> m_xWizardImpl; // hold members in this structure to allow keeping compatible when members are added
std::unique_ptr<RoadmapWizardImpl> m_xRoadmapImpl;
/// travel to the previous state void travelPrevious();
/** removes a page from the history. Should be called when the page is being disabled
*/ void removePageFromHistory(WizardTypes::WizardState nToRemove);
/** skips one or more states, until a given state is reached
The method behaves as if from the current state, <method>travelNext</method>s were called successively, until <arg>_nTargetState</arg> is reached, but without actually creating or displaying the \EDntermediate pages.
The skipped states appear in the state history, so <method>travelPrevious</method> will make use of them.
/** moves back one or more states, until a given state is reached
This method allows traveling backwards more than one state without actually showing the intermediate states.
For instance, if you want to travel two steps backward at a time, you could used two travelPrevious calls, but this would <em>show</em> both pages, which is not necessary, since you're interested in the target page only. Using <member>skipBackwardUntil</member> relieves you of this.
/// helper class to temporarily suspend any traveling in the wizard class RoadmapWizardTravelSuspension
{ public:
RoadmapWizardTravelSuspension(RoadmapWizard& rWizard)
: m_pOWizard(&rWizard)
{
m_pOWizard->suspendTraveling(RoadmapWizard::AccessGuard());
}
~RoadmapWizardTravelSuspension()
{ if (m_pOWizard)
m_pOWizard->resumeTraveling(RoadmapWizard::AccessGuard());
}
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.