/* -*- 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 .
*/
bool FmFormShell::PrepareClose(bool bUI)
{ if (GetImpl()->didPrepareClose_Lock()) // we already made a PrepareClose for the current modifications of the current form returntrue;
bool bResult = true; // Save the data records, not in DesignMode and FilterMode if (!m_bDesignMode && !GetImpl()->isInFilterMode_Lock() &&
m_pFormView && m_pFormView->GetActualOutDev() &&
m_pFormView->GetActualOutDev()->GetOutDevType() == OUTDEV_WINDOW)
{
SdrPageView* pCurPageView = m_pFormView->GetSdrPageView();
if(pWindow)
{ // First, the current contents of the controls are stored. // If everything has gone smoothly, the modified records are stored. if (GetImpl()->getActiveController_Lock().is())
{ const svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures_Lock(); if ( rController->commitCurrentControl() )
{ constbool bModified = rController->isModifiedRow();
void FmFormShell::impl_setDesignMode(bool bDesign)
{ if (m_pFormView)
{ if (!bDesign)
m_nLastSlot = SID_FM_DESIGN_MODE;
GetImpl()->SetDesignMode_Lock(bDesign); // my m_bDesignMode is also set by the Impl ...
} else
{
m_bHasForms = false;
m_bDesignMode = bDesign;
UIFeatureChanged();
}
// set MasterSlot switch( nSlot )
{ case SID_FM_PUSHBUTTON: case SID_FM_RADIOBUTTON: case SID_FM_CHECKBOX: case SID_FM_FIXEDTEXT: case SID_FM_GROUPBOX: case SID_FM_LISTBOX: case SID_FM_COMBOBOX: case SID_FM_NAVIGATIONBAR: case SID_FM_EDIT: case SID_FM_DBGRID: case SID_FM_IMAGEBUTTON: case SID_FM_IMAGECONTROL: case SID_FM_FILECONTROL: case SID_FM_DATEFIELD: case SID_FM_TIMEFIELD: case SID_FM_NUMERICFIELD: case SID_FM_CURRENCYFIELD: case SID_FM_PATTERNFIELD: case SID_FM_FORMATTEDFIELD: case SID_FM_SCROLLBAR: case SID_FM_SPINBUTTON:
m_nLastSlot = nSlot; break;
}
// set the Identifier and Inventor of the Uno control
SdrObjKind nIdentifier = SdrObjKind::NONE; switch( nSlot )
{ case SID_FM_CHECKBOX:
nIdentifier = SdrObjKind::FormCheckbox; break; case SID_FM_PUSHBUTTON:
nIdentifier = SdrObjKind::FormButton; break; case SID_FM_FIXEDTEXT:
nIdentifier = SdrObjKind::FormFixedText; break; case SID_FM_LISTBOX:
nIdentifier = SdrObjKind::FormListbox; break; case SID_FM_EDIT:
nIdentifier = SdrObjKind::FormEdit; break; case SID_FM_RADIOBUTTON:
nIdentifier = SdrObjKind::FormRadioButton; break; case SID_FM_GROUPBOX:
nIdentifier = SdrObjKind::FormGroupBox; break; case SID_FM_COMBOBOX:
nIdentifier = SdrObjKind::FormCombobox; break; case SID_FM_NAVIGATIONBAR:
nIdentifier = SdrObjKind::FormNavigationBar; break; case SID_FM_DBGRID:
nIdentifier = SdrObjKind::FormGrid; break; case SID_FM_IMAGEBUTTON:
nIdentifier = SdrObjKind::FormImageButton; break; case SID_FM_IMAGECONTROL:
nIdentifier = SdrObjKind::FormImageControl; break; case SID_FM_FILECONTROL:
nIdentifier = SdrObjKind::FormFileControl; break; case SID_FM_DATEFIELD:
nIdentifier = SdrObjKind::FormDateField; break; case SID_FM_TIMEFIELD:
nIdentifier = SdrObjKind::FormTimeField; break; case SID_FM_NUMERICFIELD:
nIdentifier = SdrObjKind::FormNumericField; break; case SID_FM_CURRENCYFIELD:
nIdentifier = SdrObjKind::FormCurrencyField; break; case SID_FM_PATTERNFIELD:
nIdentifier = SdrObjKind::FormPatternField; break; case SID_FM_FORMATTEDFIELD:
nIdentifier = SdrObjKind::FormFormattedField; break; case SID_FM_SCROLLBAR:
nIdentifier = SdrObjKind::FormScrollbar; break; case SID_FM_SPINBUTTON:
nIdentifier = SdrObjKind::FormSpinButton; break;
}
switch ( nSlot )
{ case SID_FM_CHECKBOX: case SID_FM_PUSHBUTTON: case SID_FM_FIXEDTEXT: case SID_FM_LISTBOX: case SID_FM_EDIT: case SID_FM_RADIOBUTTON: case SID_FM_COMBOBOX: case SID_FM_NAVIGATIONBAR: case SID_FM_GROUPBOX: case SID_FM_DBGRID: case SID_FM_IMAGEBUTTON: case SID_FM_IMAGECONTROL: case SID_FM_FILECONTROL: case SID_FM_DATEFIELD: case SID_FM_TIMEFIELD: case SID_FM_NUMERICFIELD: case SID_FM_CURRENCYFIELD: case SID_FM_PATTERNFIELD: case SID_FM_FORMATTEDFIELD: case SID_FM_SCROLLBAR: case SID_FM_SPINBUTTON:
{ const SfxBoolItem* pGrabFocusItem = rReq.GetArg<SfxBoolItem>(SID_FM_TOGGLECONTROLFOCUS); if ( pGrabFocusItem && pGrabFocusItem->GetValue() )
{ // see below
SfxViewShell* pShell = GetViewShell();
vcl::Window* pShellWnd = pShell ? pShell->GetWindow() : nullptr; if ( pShellWnd )
pShellWnd->GrabFocus(); break;
}
if ( rReq.GetModifier() & KEY_MOD1 )
{ // #99013# if selected with control key, return focus to current view // do this asynchron, so that the creation can be finished first // reusing the SID_FM_TOGGLECONTROLFOCUS is somewhat hacky... which it wouldn't if it would have another // name, so I do not really have a big problem with this...
SfxBoolItem aGrabFocusIndicatorItem( SID_FM_TOGGLECONTROLFOCUS, true );
GetViewShell()->GetViewFrame().GetDispatcher()->ExecuteList(
nSlot, SfxCallMode::ASYNCHRON,
{ &aGrabFocusIndicatorItem });
}
case SID_FM_TOGGLECONTROLFOCUS:
{
FmFormView* pFormView = GetFormView(); if ( !pFormView ) break;
// if we execute this ourself, then either the application does not implement an own handling for this, // of we're on the top of the dispatcher stack, which means a control has the focus. // In the latter case, we put the focus to the document window, otherwise, we focus the first control constbool bHasControlFocus = GetImpl()->HasControlFocus_Lock(); if ( bHasControlFocus )
{ if (m_pFormView)
{ const OutputDevice* pDevice = m_pFormView->GetActualOutDev();
vcl::Window* pWindow = pDevice->GetOwnerWindow(); if ( pWindow )
pWindow->GrabFocus();
}
} else
{
pFormView->GrabFirstControlFocus( );
}
} break;
case SID_FM_VIEW_AS_GRID:
GetImpl()->CreateExternalView_Lock(); break; case SID_FM_CONVERTTO_EDIT : case SID_FM_CONVERTTO_BUTTON : case SID_FM_CONVERTTO_FIXEDTEXT : case SID_FM_CONVERTTO_LISTBOX : case SID_FM_CONVERTTO_CHECKBOX : case SID_FM_CONVERTTO_RADIOBUTTON : case SID_FM_CONVERTTO_GROUPBOX : case SID_FM_CONVERTTO_COMBOBOX : case SID_FM_CONVERTTO_IMAGEBUTTON : case SID_FM_CONVERTTO_FILECONTROL : case SID_FM_CONVERTTO_DATE : case SID_FM_CONVERTTO_TIME : case SID_FM_CONVERTTO_NUMERIC : case SID_FM_CONVERTTO_CURRENCY : case SID_FM_CONVERTTO_PATTERN : case SID_FM_CONVERTTO_IMAGECONTROL : case SID_FM_CONVERTTO_FORMATTED : case SID_FM_CONVERTTO_SCROLLBAR : case SID_FM_CONVERTTO_SPINBUTTON : case SID_FM_CONVERTTO_NAVIGATIONBAR :
GetImpl()->executeControlConversionSlot_Lock(FmXFormShell::SlotToIdent(nSlot)); // after the conversion, re-determine the selection, since the // selected object has changed
GetImpl()->SetSelection_Lock(GetFormView()->GetMarkedObjectList()); break; case SID_FM_LEAVE_CREATE:
m_nLastSlot = 0;
rReq.Done(); break; case SID_FM_SHOW_PROPERTY_BROWSER:
{ const SfxBoolItem* pShowItem = rReq.GetArg<SfxBoolItem>(SID_FM_SHOW_PROPERTIES); bool bShow = true; if ( pShowItem )
bShow = pShowItem->GetValue();
GetImpl()->ShowSelectionProperties_Lock(bShow);
rReq.Done();
} break;
case SID_FM_PROPERTIES:
{ // display the PropertyBrowser const SfxBoolItem* pShowItem = rReq.GetArg<SfxBoolItem>(nSlot); bool bShow = pShowItem == nullptr || pShowItem->GetValue();
OSL_ENSURE( GetImpl()->onlyControlsAreMarked_Lock(), "FmFormShell::Execute: ControlProperties should be disabled!" ); if ( bShow )
GetImpl()->selectLastMarkedControls_Lock();
GetImpl()->ShowSelectionProperties_Lock(bShow);
rReq.Done();
} break; case SID_FM_SHOW_PROPERTIES: case SID_FM_ADD_FIELD: case SID_FM_FILTER_NAVIGATOR: case SID_FM_SHOW_DATANAVIGATOR :
{ // request may explicitly request to show/hide these // so may or may not result in a ToggleChildWindow
GetViewShell()->GetViewFrame().ChildWindowExecute(rReq);
rReq.Done();
} break; case SID_FM_SHOW_FMEXPLORER:
{ if (!m_pFormView) // force setting the view
GetViewShell()->GetViewFrame().GetDispatcher()->Execute(SID_CREATE_SW_DRAWVIEW);
case SID_FM_AUTOCONTROLFOCUS:
{
FmFormModel* pModel = GetFormModel();
DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !"); // should have been disabled in GetState if we don't have a FormModel
pModel->SetAutoControlFocus( !pModel->GetAutoControlFocus() );
GetViewShell()->GetViewFrame().GetBindings().Invalidate(SID_FM_AUTOCONTROLFOCUS);
} break; case SID_FM_OPEN_READONLY:
{
FmFormModel* pModel = GetFormModel();
DBG_ASSERT(pModel, "FmFormShell::Execute : invalid call !"); // should have been disabled in GetState if we don't have a FormModel
pModel->SetOpenInDesignMode( !pModel->GetOpenInDesignMode() );
GetViewShell()->GetViewFrame().GetBindings().Invalidate(SID_FM_OPEN_READONLY);
} break; case SID_FM_USE_WIZARDS:
{
GetImpl()->SetWizardUsing_Lock(!GetImpl()->GetWizardUsing_Lock());
GetViewShell()->GetViewFrame().GetBindings().Invalidate(SID_FM_USE_WIZARDS);
} break; case SID_FM_SEARCH:
{ const svx::ControllerFeatures& rController = GetImpl()->getActiveControllerFeatures_Lock(); if ( rController->commitCurrentControl() && rController->commitCurrentRecord() )
GetImpl()->ExecuteSearch_Lock();
rReq.Done();
} break;
case SID_FM_RECORD_FIRST: case SID_FM_RECORD_PREV: case SID_FM_RECORD_NEXT: case SID_FM_RECORD_LAST: case SID_FM_RECORD_NEW: case SID_FM_REFRESH: case SID_FM_REFRESH_FORM_CONTROL: case SID_FM_RECORD_DELETE: case SID_FM_RECORD_UNDO: case SID_FM_RECORD_SAVE: case SID_FM_REMOVE_FILTER_SORT: case SID_FM_SORTDOWN: case SID_FM_SORTUP: case SID_FM_AUTOFILTER: case SID_FM_ORDERCRIT: case SID_FM_FORM_FILTERED:
{
GetImpl()->ExecuteFormSlot_Lock(nSlot);
rReq.Done();
} break;
rReq.Done();
} break; case SID_FM_FILTER_EXECUTE: case SID_FM_FILTER_EXIT:
{ bool bCancelled = ( SID_FM_FILTER_EXIT == nSlot ); bool bReopenNavigator = false;
if ( !bCancelled )
{ // if the filter navigator is still open, we need to close it, so it can possibly // commit it's most recent changes if (GetViewShell()) if ( GetViewShell()->GetViewFrame().HasChildWindow( SID_FM_FILTER_NAVIGATOR ) )
{
GetViewShell()->GetViewFrame().ToggleChildWindow( SID_FM_FILTER_NAVIGATOR );
bReopenNavigator = true;
}
if ( GetViewShell()->GetViewFrame().HasChildWindow( SID_FM_FILTER_NAVIGATOR ) // closing the window was denied, for instance because of an invalid criterion
|| ( xController.is()
&& !GetImpl()->getActiveControllerFeatures_Lock()->commitCurrentControl()
) // committing the controller was denied
)
{
rReq.Done(); break;
}
}
if ( bReopenNavigator ) // we closed the navigator only to implicitly commit it (as we do not have another // direct wire to it), but to the user, it should look as it was always open
GetViewShell()->GetViewFrame().ToggleChildWindow( SID_FM_FILTER_NAVIGATOR );
} break;
case SID_FM_FILTER_START:
{
GetImpl()->startFiltering_Lock();
rReq.Done();
// initially open the filter navigator, the whole form based filter is pretty useless without it
SfxBoolItem aIdentifierItem( SID_FM_FILTER_NAVIGATOR, true );
GetViewShell()->GetViewFrame().GetDispatcher()->ExecuteList(
SID_FM_FILTER_NAVIGATOR, SfxCallMode::ASYNCHRON,
{ &aIdentifierItem });
} break;
}
}
case SID_FM_FILTER_EXECUTE: case SID_FM_FILTER_EXIT: if (!GetImpl()->isInFilterMode_Lock())
rSet.DisableItem( nWhich ); break;
case SID_FM_USE_WIZARDS: if (!SvtModuleOptions().IsDataBaseInstalled())
rSet.Put( SfxVisibilityItem( nWhich, false ) ); elseif (!GetFormModel())
rSet.DisableItem( nWhich ); else
rSet.Put(SfxBoolItem(nWhich, GetImpl()->GetWizardUsing_Lock())); break; case SID_FM_AUTOCONTROLFOCUS: if (!GetFormModel())
rSet.DisableItem( nWhich ); else
rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetAutoControlFocus() ) ); break; case SID_FM_OPEN_READONLY: if (!GetFormModel())
rSet.DisableItem( nWhich ); else
rSet.Put( SfxBoolItem(nWhich, GetFormModel()->GetOpenInDesignMode() ) ); break;
case SID_FM_NAVIGATIONBAR: case SID_FM_DBGRID: if (!SvtModuleOptions().IsDataBaseInstalled())
{
rSet.Put( SfxVisibilityItem( nWhich, false ) ); break;
}
[[fallthrough]];
case SID_FM_SCROLLBAR: case SID_FM_IMAGECONTROL: case SID_FM_FILECONTROL: case SID_FM_CURRENCYFIELD: case SID_FM_PATTERNFIELD: case SID_FM_IMAGEBUTTON: case SID_FM_RADIOBUTTON: case SID_FM_COMBOBOX: case SID_FM_GROUPBOX: case SID_FM_CHECKBOX: case SID_FM_PUSHBUTTON: case SID_FM_FIXEDTEXT: case SID_FM_LISTBOX: case SID_FM_EDIT: case SID_FM_DATEFIELD: case SID_FM_TIMEFIELD: case SID_FM_NUMERICFIELD: case SID_FM_FORMATTEDFIELD: case SID_FM_SPINBUTTON: if (!m_bDesignMode)
rSet.DisableItem( nWhich ); else
{ bool bLayerLocked = false; if (m_pFormView)
{ // If the css::drawing::Layer is locked, the slots must be disabled. #36897
SdrPageView* pPV = m_pFormView->GetSdrPageView(); if (pPV != nullptr)
bLayerLocked = pPV->IsLayerLocked(m_pFormView->GetActiveLayer());
} if (bLayerLocked)
rSet.DisableItem( nWhich ); else
rSet.Put( SfxBoolItem(nWhich, (nWhich==m_nLastSlot)) );
} break; case SID_FM_FILTER_NAVIGATOR_CONTROL:
{ if (GetImpl()->isInFilterMode_Lock())
rSet.Put(SfxObjectItem(nWhich, this)); else
rSet.Put(SfxObjectItem(nWhich));
} break; case SID_FM_FIELDS_CONTROL: case SID_FM_PROPERTY_CONTROL:
{ if (!m_bDesignMode || !m_pFormView || !m_bHasForms)
rSet.Put(SfxObjectItem(nWhich)); else
rSet.Put(SfxObjectItem(nWhich, this));
} break; case SID_FM_FMEXPLORER_CONTROL: case SID_FM_DATANAVIGATOR_CONTROL :
{ if (!m_bDesignMode || !m_pFormView)
rSet.Put(SfxObjectItem(nWhich)); else
rSet.Put(SfxObjectItem(nWhich, this));
} break; case SID_FM_ADD_FIELD: case SID_FM_SHOW_FMEXPLORER: case SID_FM_SHOW_PROPERTIES: case SID_FM_FILTER_NAVIGATOR: case SID_FM_SHOW_DATANAVIGATOR:
{ if ( GetViewShell()->GetViewFrame().KnowsChildWindow(nWhich) )
rSet.Put( SfxBoolItem( nWhich, GetViewShell()->GetViewFrame().HasChildWindow(nWhich)) ); else
rSet.DisableItem(nWhich);
} break;
case SID_FM_SHOW_PROPERTY_BROWSER:
{
rSet.Put(SfxBoolItem(nWhich, GetImpl()->IsPropBrwOpen_Lock()));
} break;
case SID_FM_CTL_PROPERTIES:
{ // potentially, give the Impl the opportunity to update its // current objects which are aligned with the current MarkList if (GetImpl()->IsSelectionUpdatePending_Lock())
GetImpl()->ForceUpdateSelection_Lock();
if (!m_pFormView || !m_bDesignMode || !GetImpl()->onlyControlsAreMarked_Lock())
rSet.DisableItem( nWhich ); else
{ boolconst bChecked = GetImpl()->IsPropBrwOpen_Lock() && !GetImpl()->isSolelySelected_Lock(GetImpl()->getCurrentForm_Lock()); // if the property browser is open, and only controls are marked, and the current selection // does not consist of only the current form, then the current selection is the (composition of) // the currently marked controls
rSet.Put( SfxBoolItem( nWhich, bChecked ) );
}
} break;
case SID_FM_PROPERTIES:
{ // potentially, give the Impl the opportunity to update its // current objects which are aligned with the current MarkList if (GetImpl()->IsSelectionUpdatePending_Lock())
GetImpl()->ForceUpdateSelection_Lock();
if (!m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm_Lock().is())
rSet.DisableItem( nWhich ); else
{ boolconst bChecked = GetImpl()->IsPropBrwOpen_Lock() && GetImpl()->isSolelySelected_Lock(GetImpl()->getCurrentForm_Lock());
rSet.Put(SfxBoolItem(nWhich, bChecked));
}
} break; case SID_FM_TAB_DIALOG: // potentially, give the Impl the opportunity to update its // current objects which are aligned with the current MarkList if (GetImpl()->IsSelectionUpdatePending_Lock())
GetImpl()->ForceUpdateSelection_Lock();
if (!m_pFormView || !m_bDesignMode || !GetImpl()->getCurrentForm_Lock().is() )
rSet.DisableItem( nWhich ); break; case SID_FM_DESIGN_MODE: if (!m_pFormView || GetImpl()->IsReadonlyDoc_Lock())
rSet.DisableItem( nWhich ); else
rSet.Put( SfxBoolItem(nWhich, m_bDesignMode) ); break; case SID_FM_SEARCH: case SID_FM_RECORD_FIRST: case SID_FM_RECORD_NEXT: case SID_FM_RECORD_PREV: case SID_FM_RECORD_LAST: case SID_FM_RECORD_NEW: case SID_FM_RECORD_DELETE: case SID_FM_RECORD_ABSOLUTE: case SID_FM_RECORD_TOTAL: case SID_FM_RECORD_SAVE: case SID_FM_RECORD_UNDO: case SID_FM_FORM_FILTERED: case SID_FM_REMOVE_FILTER_SORT: case SID_FM_SORTUP: case SID_FM_SORTDOWN: case SID_FM_ORDERCRIT: case SID_FM_FILTER_START: case SID_FM_AUTOFILTER: case SID_FM_REFRESH: case SID_FM_REFRESH_FORM_CONTROL: case SID_FM_VIEW_AS_GRID:
GetFormState(rSet,nWhich); break;
case SID_FM_CHANGECONTROLTYPE:
{ if ( !m_pFormView || !m_bDesignMode )
rSet.DisableItem( nWhich ); else
{ if (!GetImpl()->canConvertCurrentSelectionToControl_Lock(u"ConvertToFixed")) // if it cannot be converted to a fixed text, it is no single control
rSet.DisableItem( nWhich );
}
} break;
case SID_FM_CONVERTTO_FILECONTROL : case SID_FM_CONVERTTO_CURRENCY : case SID_FM_CONVERTTO_PATTERN : case SID_FM_CONVERTTO_IMAGECONTROL : case SID_FM_CONVERTTO_SCROLLBAR : case SID_FM_CONVERTTO_NAVIGATIONBAR : case SID_FM_CONVERTTO_IMAGEBUTTON : case SID_FM_CONVERTTO_EDIT : case SID_FM_CONVERTTO_BUTTON : case SID_FM_CONVERTTO_FIXEDTEXT : case SID_FM_CONVERTTO_LISTBOX : case SID_FM_CONVERTTO_CHECKBOX : case SID_FM_CONVERTTO_RADIOBUTTON : case SID_FM_CONVERTTO_GROUPBOX : case SID_FM_CONVERTTO_COMBOBOX : case SID_FM_CONVERTTO_DATE : case SID_FM_CONVERTTO_TIME : case SID_FM_CONVERTTO_NUMERIC : case SID_FM_CONVERTTO_FORMATTED : case SID_FM_CONVERTTO_SPINBUTTON :
{ if (!m_pFormView || !m_bDesignMode || !GetImpl()->canConvertCurrentSelectionToControl_Lock(FmXFormShell::SlotToIdent(nWhich)))
rSet.DisableItem( nWhich ); else
{
rSet.Put( SfxBoolItem( nWhich, false ) ); // just to have a defined state (available and not checked)
}
} break;
}
nWhich = aIter.NextWhich();
}
}
// first, prev, next, last, and absolute affect the nav controller, not the // active controller case SID_FM_RECORD_FIRST: case SID_FM_RECORD_PREV: case SID_FM_RECORD_NEXT: case SID_FM_RECORD_LAST: case SID_FM_RECORD_NEW: case SID_FM_RECORD_SAVE: case SID_FM_RECORD_UNDO: case SID_FM_RECORD_DELETE: case SID_FM_REFRESH: case SID_FM_REFRESH_FORM_CONTROL: case SID_FM_REMOVE_FILTER_SORT: case SID_FM_SORTUP: case SID_FM_SORTDOWN: case SID_FM_AUTOFILTER: case SID_FM_ORDERCRIT:
bEnable = GetImpl()->IsFormSlotEnabled( nWhich, nullptr ); break;
// We activate our view if we are activated ourself, but sometimes the Activate precedes the SetView. // But here we know both the view and our activation state so we at least are able to pass the latter // to the former. // FS - 30.06.99 - 67308 if ( IsActive() )
GetImpl()->viewActivated_Lock(*m_pFormView);
}
void FmFormShell::DetermineForms(bool bInvalidate)
{ // are there forms on the current page bool bForms = GetImpl()->hasForms_Lock(); if (bForms != m_bHasForms)
{
m_bHasForms = bForms; if (bInvalidate)
UIFeatureChanged();
}
}
void FmFormShell::ToggleControlFocus( const SdrUnoObj& i_rUnoObject, const SdrView& i_rView, const OutputDevice& i_rDevice ) const
{ try
{ // check if the focus currently is in a control // Well, okay, do it the other way 'round: Check whether the current control of the active controller // actually has the focus. This should be equivalent. constbool bHasControlFocus = GetImpl()->HasControlFocus_Lock();
if ( bHasControlFocus )
{
vcl::Window* pWindow = i_rDevice.GetOwnerWindow();
OSL_ENSURE( pWindow, "FmFormShell::ToggleControlFocus: I need a Window, really!" ); if ( pWindow )
pWindow->GrabFocus();
} else
{
Reference< XControl > xControl;
GetFormControl( i_rUnoObject.GetUnoControlModel(), i_rView, i_rDevice, xControl );
Reference< XWindow > xControlWindow( xControl, UNO_QUERY ); if ( xControlWindow.is() )
xControlWindow->setFocus();
}
} catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("svx");
}
}
// we can only retrieve controls for SdrObjects which belong to page which is actually displayed in the given view
SdrPageView* pPageView = _rView.GetSdrPageView();
SdrPage* pPage = pPageView ? pPageView->GetPage() : nullptr;
OSL_ENSURE( pPage, "FmFormShell::GetFormControl: no page displayed in the given view!" ); if ( !pPage ) return nullptr;
#if OSL_DEBUG_LEVEL > 0 // perhaps we are fed with a control model which lives on a page other than the one displayed // in the given view. This is worth being reported as error, in non-product builds.
FmFormModel* pModel = GetFormModel(); if ( pModel )
{
sal_uInt16 pageCount = pModel->GetPageCount(); for ( sal_uInt16 page = 0; page < pageCount; ++page )
{
pPage = pModel->GetPage( page );
OSL_ENSURE( pPage, "FmFormShell::GetFormControl: NULL page encountered!" ); if ( !pPage ) continue;
pUnoObject = lcl_findUnoObject( *pPage, _rxModel );
OSL_ENSURE( !pUnoObject, "FmFormShell::GetFormControl: the given control model belongs to a wrong page (displayed elsewhere)!" );
}
} #else
(void) this; // avoid loplugin:staticmethods #endif
FmFormModel* pModel = GetFormModel(); if (pModel) // Switch off the undo environment for the time of the transition. This ensures that // one can also change non-transient properties there. (It should be done with // caution, however, and it should always be reversed when one switches the mode back. // An example is the setting of the maximum text length by the OEditModel on its control.)
pModel->GetUndoEnv().Lock();
// then the actual switch if ( m_bDesignMode || PrepareClose() )
impl_setDesignMode(!m_bDesignMode );
// and my undo environment back on if ( pModel )
pModel->GetUndoEnv().UnLock();
}
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.