/* -*- 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 .
*/
void OJoinController::SaveTabWinPosSize(OTableWindow const * pTabWin, tools::Long nOffsetX, tools::Long nOffsetY)
{ // the data for the window const TTableWindowData::value_type& pData = pTabWin->GetData();
OSL_ENSURE(pData != nullptr, "SaveTabWinPosSize : TabWin has no data !");
// set Position & Size of data anew (with current window parameters)
Point aPos = pTabWin->GetPosPixel();
aPos.AdjustX(nOffsetX );
aPos.AdjustY(nOffsetY );
pData->SetPosition(aPos);
pData->SetSize(pTabWin->GetSizePixel());
AddTableDialogContext& OJoinController::impl_getDialogContext() const
{ if (!m_pDialogContext)
{
OJoinController* pNonConstThis = const_cast< OJoinController* >( this );
pNonConstThis->m_pDialogContext.reset( new AddTableDialogContext( *pNonConstThis ) );
}
assert(m_pDialogContext && "always exists at this point"); return *m_pDialogContext;
}
void OJoinController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
{ switch(_nId)
{ case ID_BROWSER_EDITDOC: if(isEditable())
{ // the state should be changed to not editable switch (saveModified())
{ case RET_CANCEL: // don't change anything here so return return; case RET_NO:
reset();
setModified(false); // and we are not modified yet break; default: break;
}
}
setEditable(!isEditable());
getJoinView()->setReadOnly(!isEditable());
InvalidateAll(); return; case ID_BROWSER_ADDTABLE: if (m_xAddTableDialog)
{
m_xAddTableDialog->response(RET_CLOSE);
getView()->GrabFocus();
} else
{
runDialogAsync();
} break; default:
OJoinController_BASE::Execute(_nId,aArgs);
}
InvalidateFeature(_nId);
}
void OJoinController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, tools::Long nOffsetX, tools::Long nOffsetY )
{ // Deletion and recreation of the old implementation with the current model is not correct anymore: // The TabWins have a pointer to their data, but they are managed by me. When I delete the old ones, the TabWins suddenly have a pointer to objects, which no longer exist. // If the TabWins had a SetData, I could save that effort... but they don't, further I also would still have to set information anew, which actually didn't change. // So I don't delete the TabWinDatas, but only update them.
OSL_ENSURE(m_vTableData.size() == pTabWinList->size(), "OJoinController::SaveTabWinsPosSize : inconsistent state : should have as many TabWinDatas as TabWins !");
for (autoconst& tabWin : *pTabWinList)
SaveTabWinPosSize(tabWin.second, nOffsetX, nOffsetY);
}
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.