/* -*- 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 .
*/
if (bDataChgd)
{ if (!m_bCoreDataChanged)
{
m_xBtnCancel->set_label(m_aStrClose);
m_bCoreDataChanged = true;
}
m_aWndPreview.NotifyChange(rData);
}
}
IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl, weld::Button&, void)
{ bool bOk = false, bFormatInserted = false; while (!bOk)
{
SwStringInputDlg aDlg(m_xDialog.get(), m_aStrTitle, m_aStrLabel, OUString()); if (RET_OK == aDlg.run())
{ const OUString aFormatName(aDlg.GetInputString());
if (!aFormatName.isEmpty())
{
size_t n; for (n = 0; n < m_xTableTable->size(); ++n) if ((*m_xTableTable)[n].GetName() == aFormatName) break;
if (n >= m_xTableTable->size())
{ // Format with the name does not already exist, so take up.
std::unique_ptr<SwTableAutoFormat> pNewData(new SwTableAutoFormat(TableStyleName(aFormatName))); bool bGetOk = m_pShell->GetTableAutoFormat(*pNewData);
SAL_WARN_IF(!bGetOk, "sw.ui", "GetTableAutoFormat failed for: " << aFormatName);
// Insert sorted!! for (n = 1; n < m_xTableTable->size(); ++n) if ((*m_xTableTable)[n].GetName().toString() > aFormatName) break;
if (!m_nIndex)
{
m_xBtnRemove->set_sensitive(false);
m_xBtnRename->set_sensitive(false);
}
if (!m_bCoreDataChanged)
{
m_xBtnCancel->set_label(m_aStrClose);
m_bCoreDataChanged = true;
}
}
SelFormatHdl(*m_xLbFormat);
}
IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl, weld::Button&, void)
{ bool bOk = false; while (!bOk)
{
SwStringInputDlg aDlg(m_xDialog.get(), m_aStrRenameTitle, m_aStrLabel,
m_xLbFormat->get_selected_text()); if (aDlg.run() == RET_OK)
{ bool bFormatRenamed = false; const OUString aFormatName(aDlg.GetInputString());
if (!aFormatName.isEmpty())
{
size_t n; for (n = 0; n < m_xTableTable->size(); ++n) if ((*m_xTableTable)[n].GetName() == aFormatName) break;
if (n >= m_xTableTable->size())
{
sal_uInt8 nIndex = m_nIndex;
// no format with this name exists, so rename it
m_xLbFormat->remove(m_nDfltStylePos + nIndex);
std::unique_ptr<SwTableAutoFormat> p(m_xTableTable->ReleaseAutoFormat(nIndex));
p->SetName(TableStyleName(aFormatName));
// keep all arrays sorted! for (n = 1; n < m_xTableTable->size(); ++n) if ((*m_xTableTable)[n].GetName().toString() > aFormatName)
{ break;
}
m_xTableTable->InsertAutoFormat(n, std::move(p));
m_xLbFormat->insert_text(m_nDfltStylePos + n, aFormatName);
m_xLbFormat->select(m_nDfltStylePos + n);
if (!m_bCoreDataChanged)
{
m_xBtnCancel->set_label(m_aStrClose);
m_bCoreDataChanged = true;
}
SelFormatHdl(*m_xLbFormat);
bOk = true;
bFormatRenamed = true;
}
}
if (!bFormatRenamed)
{
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
m_xDialog.get(), VclMessageType::Error, VclButtonsType::OkCancel,
m_aStrInvalidFormat));
bOk = RET_CANCEL == xBox->run();
}
} else
bOk = true;
}
}
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.